package com.gxsf.back.repo;

import com.gxsf.back.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;


/**
 * @author BeijiRonin
 * @date 2020/11/12
 */
public interface UserRepository extends JpaRepository<User, Long> {
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("UPDATE User user set user.scope=100 where user.scope<100")
    void updateAllUserScope();

    User findByPhone(long phone);
}
